]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
LayoutManager: fix findMonitorForWindow to take a metaWindow
authorGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 16 Dec 2012 19:57:54 +0000 (20:57 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Sun, 16 Dec 2012 21:40:33 +0000 (22:40 +0100)
This makes the method usable in places where the associated window actor
might not have the right size (such as from window manager animations).
Also, make the method public from LayoutManager.

https://bugzilla.gnome.org/show_bug.cgi?id=690241

js/ui/layout.js

index 8e59383aa4ae76404cc94db769185582da121008..ae828a008fcb3024279c24855daa4c08c373f1f2 100644 (file)
@@ -325,7 +325,7 @@ const LayoutManager = new Lang.Class({
         } else {
             let focusWindow = global.display.focus_window;
             if (focusWindow)
-                i = this._chrome.findIndexForWindow(focusWindow.get_compositor_private());
+                i = this._chrome.findIndexForWindow(focusWindow);
         }
 
         return i;
@@ -513,7 +513,11 @@ const LayoutManager = new Lang.Class({
 
     findMonitorForActor: function(actor) {
         return this.monitors[this._chrome.findIndexForActor(actor)];
-    }
+    },
+
+    findMonitorForWindow: function(window) {
+        return this.monitors[this._chrome.findIndexForWindow(window)];
+    },
 });
 Signals.addSignalMethods(LayoutManager.prototype);
 
@@ -891,7 +895,8 @@ const Chrome = new Lang.Class({
     },
 
     findIndexForWindow: function(window) {
-        let i = this._findMonitorForRect(window.x, window.y, window.width, window.height);
+        let rect = window.get_input_rect();
+        let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
         if (i >= 0)
             return i;
         return this._primaryIndex; // Not on any monitor, pretend its on the primary
@@ -909,7 +914,8 @@ const Chrome = new Lang.Class({
     },
 
     findMonitorForWindow: function(window) {
-        let i = this._findMonitorForRect(window.x, window.y, window.width, window.height);
+        let rect = window.get_input_rect();
+        let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
         if (i >= 0)
             return this._monitors[i];
         else
@@ -958,14 +964,15 @@ const Chrome = new Lang.Class({
 
         for (let i = windows.length - 1; i > -1; i--) {
             let window = windows[i];
-            let layer = window.get_meta_window().get_layer();
+            let metaWindow = window.meta_window;
+            let layer = metaWindow.get_layer();
 
             // Skip minimized windows
             if (!window.showing_on_its_workspace())
                 continue;
 
             if (layer == Meta.StackLayer.FULLSCREEN) {
-                let monitor = this.findMonitorForWindow(window);
+                let monitor = this.findMonitorForWindow(metaWindow);
                 if (monitor)
                     monitor.inFullscreen = true;
             }
@@ -982,7 +989,7 @@ const Chrome = new Lang.Class({
                 }
 
                 // Or whether it is monitor sized
-                let monitor = this.findMonitorForWindow(window);
+                let monitor = this.findMonitorForWindow(metaWindow);
                 if (monitor &&
                     window.x <= monitor.x &&
                     window.x + window.width >= monitor.x + monitor.width &&